package com.tbs.easyhomemoneyserver.dao

import com.tbs.easyhomemoneyserver.DO.FlowNode
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Select
import org.apache.ibatis.annotations.Update
import tk.mybatis.mapper.common.BaseMapper

@Mapper
interface FlowNodeMapper : BaseMapper<FlowNode> {
    @Update(
        "update flow_node set" +
                " status=#{param2} where " +
                "begin_node=#{param1} " +
                "or (id=#{param1} " +
                "and begin_node is null)"
    )
    fun setStatusByBeginNodeId(beginNode: Long?, status: Byte?): Int

    @Select(
        "select * from flow_node where" +
                " begin_node=#{param1} " +
                "or (id=#{param1} " +
                "and begin_node is null)"
    )
    fun findByBeginNode(beginNode: Long?): List<FlowNode?>?
}
